<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
 我的足迹
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin('jy_jdpm/member.index/');
$return=array();
$return['ntime']=TIMESTAMP;
$return['channel'] = $_SESSION['channel'];
set_html('title','足迹-'.$this->plugin_setting('basic')['title']);
if($_RQ['op']=='main'){
	$h=pdo_getall('jy_jdpm_member_footmark',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']),'','','createtime desc');
	$list=array();
	foreach($h as $k=>$v){
		$list[]=$v['pid'];
	}
	$list=array_unique($list);
	$params=array('uniacid'=>$_SESSION['uniacid'],);
	if($_RQ['status']==1){
		$params=array('starttime <'=>time(),'endstatus'=>0);
		
	}
	if($_RQ['status']==0){
		$params=array('starttime >'=>time(),'endstatus'=>0);
	}
	if($_RQ['status']==2){
		$params=array('endstatus >'=>0);
	}
	if($list){
	$params['id']=$list;
	$fields=array('id','onset','price','nowprice','goodsid','starttime','pname','endtime','endstatus','status','stateing');
	$pindex = max(1, intval($_RQ['page']));
	$psize = 12;
	$total='';
	$list=pdo_getslice('jy_jdpm_auction',$params,array($pindex,$psize),$total,$fields);
	foreach($list as &$v){
		$good=get_goodsinfo($v['goodsid']);
		$v['images']=$good['image'];
		if($v['starttime']>time() && $v['endstatus']==0){
			$v['stage']='fut';
			$v['price']=0;
			$v['pledge']=number_format($v['nowprice']/2,2,'.','');
		}
		if($v['endstatus']!=0){
			$v['status']=$v['endstatus'];
			$v['stage']='end';
			$v['price']=$v['nowprice'];
			$v['pledge']=number_format($v['nowprice']/2,2,'.','');
		}
		if($v['starttime']<time() && $v['endstatus']==0){
			$v['stage']='ing';
			$v['price']=$v['nowprice'];
			$v['pledge']=number_format($v['nowprice']/2,2,'.','');
		}
		
	}
	
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	}else{
		$list=array();
	}
	$return['list']=$list;
	$return['status']=$_RQ['status']?$_RQ['status']:0;
	exi($return);
}
if($_RQ['op']=='myatt'){
	$h=pdo_getall('jy_jdpm_attention',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'rela'=>'p-u'),array('pid'));
	$list=array();
	foreach($h as $k=>$v){
		$list[]=$v['pid'];
	}
	$list=array_unique($list);
	$params=array('uniacid'=>$_SESSION['uniacid'],);
	if($_RQ['status']=='ing'){
		$params=array('starttime <'=>time(),'endstatus'=>0);
		
	}
	if($_RQ['status']=='fut'){
		$params=array('starttime >'=>time(),'endstatus'=>0);
	}
	if($_RQ['status']=='end'){
		$params=array('endstatus >'=>0);
	}
	if($list){
	$params['id']=$list;
	$fields=array('id','onset','price','nowprice','goodsid','starttime','pname','endtime','endstatus','status','stateing');
	$pindex = max(1, intval($_RQ['page']));
	$psize = 12;
	$total='';
	$list=pdo_getslice('jy_jdpm_auction',$params,array($pindex,$psize),$total,$fields);
	foreach($list as &$v){
		$good=get_goodsinfo($v['goodsid']);
		$v['images']=$good['image'];
		if($v['starttime']>time() && $v['endstatus']==0){
			$v['stage']='fut';
			$v['price']=0;
			$v['pledge']=number_format($v['nowprice']/2,2,'.','');
		}
		if($v['endstatus']!=0){
			$v['status']=$v['endstatus'];
			$v['stage']='end';
			$v['price']=$v['nowprice'];
			$v['pledge']=number_format($v['nowprice']/2,2,'.','');
		}
		if($v['starttime']<time() && $v['endstatus']==0){
			$v['stage']='ing';
			$v['price']=$v['nowprice'];
			$v['pledge']=number_format($v['nowprice']/2,2,'.','');
		}
		
	}
	
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	}else{
		$list=array();
	}
	$return['list']=$list;
	$return['status']=$_RQ['status']?$_RQ['status']:0;
	exi($return);
}
if($_RQ['op']=='mybid'){
	$h=pdo_getall('jy_jdpm_freezelog',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']),array('pid'));
	$list=array();
	foreach($h as $k=>$v){
		$list[]=$v['pid'];
	}
	$list=array_unique($list);
	$params=array('uniacid'=>$_SESSION['uniacid'],);
	if($_RQ['status']=='ing'){
		$params=array('starttime <'=>time(),'endstatus'=>0);
		
	}
	if($_RQ['status']=='fut'){
		$params=array('starttime >'=>time(),'endstatus'=>0);
	}
	if($_RQ['status']=='end'){
		$params=array('endstatus >'=>0);
	}
	if($list){
	$params['id']=$list;
	$fields=array('id','onset','price','nowprice','goodsid','starttime','pname','endtime','endstatus','status','stateing');
	$pindex = max(1, intval($_RQ['page']));
	$psize = 12;
	$total='';
	$list=pdo_getslice('jy_jdpm_auction',$params,array($pindex,$psize),$total,$fields);
	foreach($list as &$v){
		$good=get_goodsinfo($v['goodsid']);
		$v['images']=$good['image'];
		if($v['starttime']>time() && $v['endstatus']==0){
			$v['stage']='fut';
			$v['price']=0;
			$v['pledge']=number_format($v['nowprice']/2,2,'.','');
		}
		if($v['endstatus']!=0){
			$v['status']=$v['endstatus'];
			$v['stage']='end';
			$v['price']=$v['nowprice'];
			$v['pledge']=number_format($v['nowprice']/2,2,'.','');
		}
		if($v['starttime']<time() && $v['endstatus']==0){
			$v['stage']='ing';
			$v['price']=$v['nowprice'];
			$v['pledge']=number_format($v['nowprice']/2,2,'.','');
		}
		
	}
	
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	}else{
		$list=array();
	}
	$return['list']=$list;
	$return['status']=$_RQ['status']?$_RQ['status']:0;
	exi($return);
}
